// Copyright (c) 2024 NutPi. All rights reserved.
// Author: NutPi
// Website: https://nutpi.com
// WeChat: nutpi

class Article {
  final String title;
  final String description;
  final String link;
  final String author;
  final String pubDate;

  Article({
    required this.title,
    required this.description,
    required this.link,
    required this.author,
    required this.pubDate,
  });

  factory Article.fromXml(dynamic item) {
    return Article(
      title: item.getElement('title')?.text.trim() ?? '',
      description: item.getElement('description')?.text.trim() ?? '',
      link: item.getElement('link')?.text.trim() ?? '',
      author: item.getElement('dc:creator')?.text.trim() ?? '',
      pubDate: item.getElement('pubDate')?.text.trim() ?? ''
    );
  }
}